function [true_trajectory, observations_history] = simulate_with_fixed_trajectory(controls, obstacles, laser_params, noise_params, initial_state)
% 使用固定控制序列仿真机器人运动和观测
% 输入: 
%   controls - 控制序列 [v; omega] 每列一个时间步
%   obstacles - 障碍物列表
%   laser_params - 激光雷达参数结构体
%   noise_params - 噪声参数结构体
%   initial_state - 初始状态 [x; y; theta]
% 输出:
%   true_trajectory - 真实轨迹 3xN
%   observations_history - 观测历史（cell数组）

    steps = size(controls, 2);
    dt = laser_params.dt;
    
    % 初始化
    true_state = initial_state;
    true_trajectory = zeros(3, steps);
    observations_history = cell(1, steps);
    
    % 提取参数
    Q = noise_params.Q;
    laser_range = laser_params.range;
    laser_fov = laser_params.fov;
    num_beams = laser_params.num_beams;
    laser_noise = laser_params.noise;
    
    % 仿真
    for t = 1:steps
        control = controls(:, t);
        
        % 运动模型
        true_state = motion_model(true_state, control, dt, Q);
        
        % 碰撞检测和处理
        [collision, ~] = check_collision(true_state, obstacles, 0.5);
        if collision && t > 1
            % 如果碰撞，恢复到上一个状态并停止
            true_state = true_trajectory(:, t-1);
        end
        
        true_trajectory(:, t) = true_state;
        
        % 激光观测
        [observations, ~] = observation_model_laser(true_state, obstacles, ...
                                laser_range, laser_fov, num_beams, laser_noise);
        observations_history{t} = observations;
    end
end

